<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>左侧导航</title>
    <style>
        /* 全局样式 */
        body {
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f4f4f4;
            color: #333;
        }

        /* 树形容器 */
        .tree-container {
            width: 100%;
            height: 100vh;
            overflow-y: auto;
            padding: 20px;
            box-sizing: border-box;
            background-color: #fff;
        }

        /* 区块样式 */
        .block {
            margin-bottom: 15px;
            background-color: #fff;
            border: 1px solid #ddd;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            transition: box-shadow 0.3s ease;
        }

        .block:hover {
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }

        /* 区块标题 */
        .block-title {
            padding: 12px 15px;
            background-color: #f9f9f9;
            border-bottom: 1px solid #ddd;
            font-size: 16px;
            font-weight: bold;
            color: #333;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .block-title::after {
            content: "▶";
            font-size: 12px;
            transition: transform 0.3s ease;
        }

        .block-title.expanded::after {
            transform: rotate(90deg);
        }

        /* 区块内容 */
        .block-content {
            padding: 10px 15px;
            display: none; /* 默认隐藏 */
        }

        .block-content.expanded {
            display: block; /* 展开时显示 */
        }

        /* 选项样式 */
        .block-item {
            padding: 8px 0;
            font-size: 14px;
            color: #555;
            cursor: pointer;
            transition: color 0.3s ease, background-color 0.3s ease;
        }

        .block-item:hover {
            color: #007bff;
            background-color: #f0f8ff;
        }

        /* 子选项样式 */
        .sub-block {
            margin-left: 20px;
            margin-top: 5px;
            border-left: 2px solid #ddd;
            padding-left: 10px;
        }

        .sub-block .block-item {
            padding: 6px 0;
            font-size: 13px;
            color: #666;
        }

        .sub-block .block-item:hover {
            color: #0056b3;
            background-color: #e6f2ff;
        }

        /* 子选项标题 */
        .sub-block-title {
            font-weight: bold;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .sub-block-title::after {
            content: "▶";
            font-size: 12px;
            transition: transform 0.3s ease;
        }

        .sub-block-title.expanded::after {
            transform: rotate(90deg);
        }

        /* 子选项内容 */
        .sub-block-content {
            display: none; /* 默认隐藏 */
        }

        .sub-block-content.expanded {
            display: block; /* 展开时显示 */
        }
    </style>
</head>
<body>
    <div class="tree-container">
        <!-- 计划员 -->
        <div shiro:hasAnyRoles="planner, leader" class="block">
            <div class="block-title" onclick="toggleBlock(this)">计划员</div>
            <div class="block-content">
                <!-- 业务处理 -->
                <div class="sub-block">
                    <div class="sub-block-title" onclick="toggleSubBlock(this)">业务处理</div>
                    <div class="sub-block-content">
                        <div class="block-item" >需求计划处理</div>
                        <div class="sub-block">
                            <div class="block-item" onclick="pclassSelect01()">需求计划录入</div>
                            <div class="block-item" onclick="orderYtbList()">需求计划查询</div>
                        </div>
                        <div class="block-item" onclick="orderWbxjfaList()">编制采购计划</div>
                        <div class="block-item" onclick="updateProduct()">采购计划管理</div>
                        <div class="sub-block">
                            <div class="block-item" onclick="projectList()">采购计划查询</div>
                            <div class="block-item" onclick="projectList4()">采购计划下达</div>
                            <div class="block-item" onclick="projectListx()">未通过审批采购计划</div>
                        </div>
                    </div>
                </div>

                <!-- 供应商 -->
                <div class="sub-block">
                    <div class="sub-block-title" onclick="toggleSubBlock(this)">供应商</div>
                    <div class="sub-block-content">
                        <div class="block-item" onclick="providerCx()">供应商基本信息查询</div>
                        <div class="block-item" onclick="category()">供应商产品类别管理</div>
                        <div class="block-item" onclick="addSupply()">添加供应商</div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 供应商平台 -->
        <div shiro:hasAnyRoles="supplier, leader" class="block">
            <div class="block-title" onclick="toggleBlock(this)">供应商平台</div>
            <div class="block-content">
                <div class="block-item" onclick="mainRequire1()">供应商的信息查看</div>
                <div class="block-item" onclick="pclassSelect()">修改登录密码</div>
                <div class="block-item" onclick="proSelect()">供应商产品的维护</div>
                <div class="block-item" onclick="MaterialQuery()">产品类别的维护</div>
                <div class="block-item" onclick="projectList2()">报价维护</div>
                <div class="block-item" onclick="projectList3()">询价书报价</div>
                <div class="block-item" onclick="ProviderConsignment()">合同查询</div>
            </div>
        </div>

        <!-- 合同管理 -->
        <div shiro:hasAnyRoles="buyer, leader" class="block">
            <div class="block-title" onclick="toggleBlock(this)">合同管理</div>
            <div class="block-content">
                <div class="block-item" onclick="apply_zw()">编制合同申请</div>
                <div class="block-item" onclick="affirmPact()">确认合同申请</div>
                <div class="block-item" onclick="queryPact_qq()">查询合同申请及报批</div>
                <div class="block-item" onclick="callbackPact()">未通过合同申请(可删除)</div>
                <div class="block-item" onclick="bianzhi()">编制合同</div>
                <div class="block-item" onclick="queren()">确认合同</div>
                <div class="block-item" onclick="weihu()">维护合同</div>
                <div class="block-item" onclick="guidang()">合同归档</div>
            </div>
        </div>

        <!-- 采购员的询价与报价 -->
        <div shiro:hasAnyRoles="buyer, leader" class="block">
            <div class="block-title" onclick="toggleBlock(this)">采购员的询价与报价</div>
            <div class="block-content">
                <div class="block-item" onclick="apply()">编制询价书</div>
                <div class="block-item" onclick="queryPact()">询价书列表</div>
            </div>
        </div>

        <!-- 财务部长业务处理 -->
        <div shiro:hasRole="leader" class="block">
            <div class="block-title" onclick="toggleBlock(this)">部长业务处理</div>
            <div class="block-content">
                <div class="block-item" onclick="shenpi()">待审批合同申请</div>
                <div class="block-item" onclick="daipi()">待审批采购计划</div>
            </div>
        </div>

        <!-- 计划部长业务处理 -->
<!--        <div class="block">-->
<!--            <div class="block-title" onclick="toggleBlock(this)">计划部长业务处理</div>-->
<!--            <div class="block-content">-->
<!--                <div class="block-item" onclick="shenpi()">待审批合同申请</div>-->
<!--                <div class="block-item" onclick="daipi()">待审批采购计划</div>-->
<!--            </div>-->
<!--        </div>-->

        <!-- 厂长业务处理 -->
<!--        <div class="block">-->
<!--            <div class="block-title" onclick="toggleBlock(this)">厂长业务处理</div>-->
<!--            <div class="block-content">-->
<!--                <div class="block-item" onclick="changzhang()">待审批合同申请</div>-->
<!--            </div>-->
<!--        </div>-->
    </div>
    <script>
        // 切换大区块展开/收缩
        function toggleBlock(blockTitle) {
            const blockContent = blockTitle.nextElementSibling;
            blockTitle.classList.toggle("expanded");
            blockContent.classList.toggle("expanded");
        }

        // 切换子选项展开/收缩
        function toggleSubBlock(subBlockTitle) {
            const subBlockContent = subBlockTitle.nextElementSibling;
            subBlockTitle.classList.toggle("expanded");
            subBlockContent.classList.toggle("expanded");
        }

        // JavaScript 函数保持不变
        function mainRequire01() {
            window.parent.main.location = "planman/mainRequire.html";
        }

        function pclassSelect01() {
            window.parent.main.location = "/pclass_select.html";
        }


        function orderYtbList() {
            window.parent.main.location = "/Order_ytb_list.html";
        }

        function orderWbxjfaList() {
            window.parent.main.location = "planman/Order_wbxjfa_list.html";
        }

        function projectList() {
            window.parent.main.location = "planman/Project_list.html";
        }

        function projectList2() {
            window.parent.main.location = "planman/Project_list2.html";
        }

        function projectListx() {
            window.parent.main.location = "planman/Project_list3.html";
        }

        function projectList4() {
            window.parent.main.location = "planman/Project_list4.html";
        }

        function projectList5() {
            window.parent.main.location = "planman/Project_list5.html";
        }

        function providerCx() {
            window.parent.main.location = "planman/provider_cx.html";
        }

        function applyExam() {
            window.parent.main.location = "planman/Apply_Exam.html";
        }

        function addSupply() {
            window.parent.main.location = "planman/supply.html";
        }

        function category() {
            window.parent.main.location = "planman/category.html";
        }

        function mainRequire1() {
            window.parent.main.location = "supplyman/jiffprov_look.html";
        }

        function pclassSelect() {
            window.parent.main.location = "supplyman/ProviderContract.html";
        }

        function MaterialQuery() {
            window.parent.main.location = "supplyman/category.html";
        }

        function projectList3() {
            window.parent.main.location = "supplyman/Order_wbxjfa_list.html";
        }

        function proSelect() {
            window.parent.main.location = "supplyman/proSelect.html";
        }

        function projectList2() {
            window.parent.main.location = "supplyman/Project_list.html";
        }

        function ProviderConsignment() {
            window.parent.main.location = "supplyman/ProviderConsignment.html";
        }

        function guidang() {
            window.parent.main.location = "contractmanager/guidanghetong.html";
        }

        function weihu() {
            window.parent.main.location = "contractmanager/keweihuhetong.html";
        }

        function queren() {
            window.parent.main.location = "contractmanager/querenhetong.html";
        }

        function bianzhi() {
            window.parent.main.location = "contractmanager/bianzhilist.html";
        }

        function luru() {
            window.parent.main.location = "contractmanager/contract_view.html";
        }

        function changzhang() {
            window.parent.main.location = "contractmanager/Apply_daishen.html";
        }

        function shenpi() {
            window.parent.main.location = "Apply_daishenjihua.html";
        }

        function daipi() {
            window.parent.main.location = "Apply_daishencaiwu.html";
        }

        function apply_zw() {
            window.parent.main.location = "contractmanager/jieshilist.html";
        }

        function pactUpdate() {
            window.parent.main.location = "contractmanager/Apply_update.html";
        }

        function callbackPact() {
            window.parent.main.location = "contractmanager/Apply_kehuishou.html";
        }

        function queryPact_qq() {
            window.parent.main.location = "contractmanager/Apply_querenList.html";
        }

        function affirmPact() {
            window.parent.main.location = "contractmanager/Apply_queren.html";
        }

        function mainRequire() {
            window.parent.main.location = "queryandqueto/mainRequire.html";
        }

        function apply() {
            window.parent.main.location = "Project_list.html";
        }

        function queryPact() {
            window.parent.main.location = "queryandqueto/ask1.html";
        }

        function apply1() {
            window.parent.main.location = "queryandqueto/Project_list22.html";
        }
    </script>
</body>
</html>